<#assign classNameLower = className?uncap_first>
package ${packageName}.service;

import java.util.List;

import org.junit.Test;
import org.springframework.dao.DataAccessException;

import com.shareinfo.base.query.BaseQuery;
import com.shareinfo.base.factory.SpringBeanFactory;
<#include "/service_import.include"/>

public class ${className}ServiceTest {
	private ${className}Service ${classNameLower}Service=(${className}Service)SpringBeanFactory.getBean("${classNameLower}Service");
	
	@Test
	/** 增加数据 */
	public void saveTest(){
		${className}Model model=new ${className}Model();
		<#list table.columns as column>
			model.set${column.classColumnName?cap_first}(null);
		</#list>
		int result=${classNameLower}Service.save(model);
		System.out.println("result:"+result);
	}

	@Test
	/** 删除数据 */
	public void deleteByIdTest(){
		${table.keyJavaType} id=null;
		${className}Model model=(${className}Model)${classNameLower}Service.getById(id);
		if(model!=null){
			int result=${classNameLower}Service.deleteById(id);
			System.out.println("result:"+result);
		}else{
			System.out.println("未找到对象");
		}
	}

	@Test
	/** 修改数据 */
	public void updateTest(){
		${table.keyJavaType} id=null;
		${className}Model model=(${className}Model)${classNameLower}Service.getById(id);
		if(model!=null){
			int result=${classNameLower}Service.update(model);
			System.out.println("result:"+result);
		}else{
			System.out.println("未找到对象");
		}
	}

	/** 查询数据 */
	public Object getById(PK id) throws DataAccessException;

	/** 根据id检查是否插入或是更新数据 */
	public void saveOrUpdate(E entity) throws DataAccessException;

	/** 查询总数 */
	public Integer count(BaseQuery query) throws DataAccessException;

	/** 查询所有数据 */
	public List<E> selectList(BaseQuery query) throws DataAccessException;

}